package net.controllers;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import net.form.processing.Clasificador;
import net.form.processing.classification.EvaluadorClase;

import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/wdetailobject")
public class DetailObjectController {

	// Display the form on the get request
	@RequestMapping(method = RequestMethod.GET)
	public String showRegistration(HttpServletRequest request,
			HttpServletResponse response, HttpSession session) {

		String nameDetailobject = "";
		if (session.getAttribute("nameDetailobject") != null &&session.getAttribute("nameDetailobject") != "") {
			nameDetailobject = String.valueOf(session.getAttribute("nameDetailobject"));
		}
		EvaluadorClase c=getClasificador().getEvaluadorClase(nameDetailobject);

		return "detailObject";
	}

	private Clasificador getClasificador() {
		// TODO Auto-generated method stub
		return null;
	}

	// Process the form.
	@RequestMapping(method = RequestMethod.POST)
	public String processRegistration(BindingResult result) {
//		System.out.println("UploadFileIndexController.processRegistration POST");
		return "detailobject";
	}
	
	private String getNameObjects(HttpServletRequest request) {
		String nameObjects = "";
		if (request.getParameter("nameObjects") != "") {
			nameObjects = request.getParameter("nameObjects");
			if (nameObjects == null) {
				nameObjects = "resultKMeans";
			}
		}
		return nameObjects;
	}
}
